package com.zz.ecommerce.declareManage.exportB2BDeclare.declareManage;

import com.zz.ecommerce.common.GridRequest;
import com.zz.ecommerce.common.GridResult;
import com.zz.ecommerce.common.constants.TableConstants;
import com.zz.ecommerce.declareManage.exportB2CDeclare.declareManage.CbecElistDao;
import com.zz.ecommerce.pojo.CbecElist;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 出口B2B申报Controller
 * <p/>
 * Created by fanshilei on 2016/3/28.
 */
@Controller
@RequestMapping("/exportB2B/declareManage")
@Scope("prototype")
public class ExportB2BController {

    @Autowired
    private CbecElistDao cbecElistDao;

    /**
     * 申报清单管理
     *
     * @return
     */
    @RequestMapping(value = "declarationForm", method = {RequestMethod.GET})
    public String declarationForm() {
        return "declareManage/exportB2BDeclare/declareManage/declaration_form";
    }

    /**
     * 查询申报清单管理列表
     *
     * @param cbecElist
     * @param request
     * @return
     */
    @RequestMapping("/queryDeclareList")
    @ResponseBody
    public GridResult queryDeclareList(CbecElist cbecElist, GridRequest request) {
        return new GridResult(cbecElistDao.page(TableConstants.CBEC_ELIST, cbecElist, request.getStart(), request.getEnd(), request.getSortOrder()), request, cbecElistDao.count(TableConstants.CBEC_ELIST, cbecElist));
    }

}
